package my.utils.markdown.markdownformat.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.File;

@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
public class ImageFile {
    private File oldImage;
    private String oldImageName;
    private String fileSuffix;
    private String newParentDirectory;
    private File newImage;
    private String newImageName;

    public void updateImageName(String imageName) {
        String newImageName = imageName + fileSuffix;
        String newImagePath = StringUtils.join(newParentDirectory + "/" + newImageName);
        this.newImage = new File(newImagePath);
        this.newImageName = newImageName;
    }
}
